﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace ConstantCMapEditor3
{
    abstract public class LineHolder
    {
        abstract public bool ReadBack(String str);
        abstract public String SaveOut();
    }

    abstract public class Declaration : LineHolder
    {
        public String ClassID;
        abstract public void InstanceInit();
        abstract public void CandidateInit();
        abstract public void SelectedAction();
        abstract public void SelectedUpdate();
        abstract public void UnSelectedAction();
        abstract public void UISelectedAction();
        abstract public void UISelectedUpdate();
        abstract public void UnUISelectedAction();

        public Sprite sprite;
        public Sprite selectedNoticer = new Sprite(IntelligentTexture.IntelligentLoad("White"));


        abstract public Vector2 Position
        {
            get;
            set;
        }

        abstract public Vector2 Size
        {
            get;
            set;
        }

        abstract public float RotateR
        {
            get;
            set;
        }

        public virtual void Focus()
        {
            if (sprite != null && selectedNoticer != null) 
            {
                selectedNoticer.SpriteColor = new Color(50, 0, 0, 0);
                sprite.AttachChild(selectedNoticer);
                selectedNoticer.ScaleX = sprite.Width;
                selectedNoticer.ScaleY = sprite.Height;
            }
        }

        public virtual void UnFocus() 
        {
            if (sprite != null && selectedNoticer != null)
            {
                sprite.DettachChild(selectedNoticer);
            }
        }

        public String Direction = "";
    }

    abstract public class Relation : LineHolder
    {

    }

    public class UnknownLine : LineHolder
    {
        public String unknownData;

        override public bool ReadBack(String str)
        {
            UnknownLine instance = new UnknownLine();
            instance.unknownData = str;
            Game1.lineHolderList.Add(instance);
            return true;
        }

        override public String SaveOut()
        {
            return unknownData;
        }
    }
}
